home *** CD-ROM | disk | FTP | other *** search
/ Master Visual Basic 3 / Master Visual Basic 3 (SAMS Publishing) (1994).ISO / mvprog / original / appendix / itfun.frm (.txt) next >
Encoding:
Visual Basic Form  |  1994-06-09  |  3.3 KB  |  98 lines

  1. VERSION 2.00
  2. Begin Form frmItsFun 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "The ItsFun Program"
  5.    ClientHeight    =   4020
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1485
  8.    ClientWidth     =   7365
  9.    Height          =   4425
  10.    Icon            =   ITFUN.FRX:0000
  11.    Left            =   1035
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4020
  14.    ScaleWidth      =   7365
  15.    Top             =   1140
  16.    Width           =   7485
  17.    Begin CommandButton cmdClear 
  18.       Caption         =   "&Clear"
  19.       Height          =   1215
  20.       Left            =   4800
  21.       TabIndex        =   3
  22.       Top             =   240
  23.       Width           =   2175
  24.    End
  25.    Begin TextBox txtMyTextBox 
  26.       Alignment       =   2  'Center
  27.       Enabled         =   0   'False
  28.       Height          =   975
  29.       Left            =   1440
  30.       MultiLine       =   -1  'True
  31.       TabIndex        =   2
  32.       Top             =   1920
  33.       Width           =   4695
  34.    End
  35.    Begin CommandButton cmdSaySomething 
  36.       Caption         =   "&Say Something"
  37.       Height          =   1215
  38.       Left            =   360
  39.       TabIndex        =   1
  40.       Top             =   240
  41.       Width           =   2175
  42.    End
  43.    Begin CommandButton cmdExit 
  44.       Caption         =   "E&xit"
  45.       Height          =   510
  46.       Left            =   120
  47.       TabIndex        =   0
  48.       Top             =   3360
  49.       Width           =   1215
  50.    End
  51. ' All variables must be declared before using them.
  52. Option Explicit
  53. ' Declare a variable the will hold the session number.
  54. Dim gSessionNumber
  55. ' Declare constants
  56. Const SP_START_OF_FILE = -1
  57. Const SP_END_OF_FILE = -2
  58. ' Declare the sp_OpenSession() function from
  59. ' the TegoSND.DLL library.
  60. Declare Function sp_OpenSession Lib "TegoSND.DLL" (ByVal lpstrFileName As String) As Integer
  61. ' Declare the sp_PlaySnd() function from
  62. ' the TegoSND.DLL library.
  63. Declare Function sp_PlaySnd Lib "TegoSND.DLL" (ByVal iSessionHandler As Integer, ByVal lStartPoint As Long, ByVal lEndPoint As Long) As Long
  64. ' Declare the sp_CloseSession() function from
  65. ' the TegoSND.DLL library.
  66. Declare Function sp_CloseSession Lib "TegoSND.DLL" (ByVal iSessionHandler As Integer) As Integer
  67. Sub cmdClear_Click ()
  68.     ' Clear the text box
  69.     txtMyTextBox.Text = ""
  70. End Sub
  71. Sub cmdExit_Click ()
  72.     Dim Dummy
  73.     Dummy = sp_CloseSession(gSessionNumber)
  74.     ' Terminate the application
  75.     End
  76. End Sub
  77. Sub cmdSaySomething_Click ()
  78.     Dim Dummy
  79.     ' Set the FOntSize property of the text box to 12 points.
  80.     txtMyTextBox.FontSize = 12
  81.     txtMyTextBox.Text = "It's been fun working with you."
  82.     ' Play the WAV file through the PC speaker
  83.     Dummy = sp_PlaySnd(gSessionNumber, SP_START_OF_FILE, SP_END_OF_FILE)
  84. End Sub
  85. Sub Form_Load ()
  86.     Dim DriveName As String
  87.     Dim WavFileName As String
  88.     ' Extract the drive name where this program resides
  89.     DriveName = Left(App.Path, 2)
  90.     ' Open a WAV session
  91.     WavFileName = DriveName + "\MVPROG\WAV\ITSBEEN1.WAV"
  92.     gSessionNumber = sp_OpenSession(WavFileName)
  93. End Sub
  94. Sub Form_Unload (Cancel As Integer)
  95.     Dim Dummy
  96.     Dummy = sp_CloseSession(gSessionNumber)
  97. End Sub
  98.